package com.sss.support.poi;

import org.apache.commons.lang.xwork.StringUtils;
import org.apache.poi.ss.usermodel.Cell;

public class CellValueUtil {
	
	public static final String toStringValue(Cell c){
		switch(c.getCellType()){
		case Cell.CELL_TYPE_BLANK:
			return "";			
		case Cell.CELL_TYPE_STRING:
			return c.getStringCellValue().trim();
		case Cell.CELL_TYPE_NUMERIC:
			if(c.getNumericCellValue() == 0.0d){
				return "";
			}
			return String.valueOf((int)c.getNumericCellValue());
		default:
			return "";
		}		
	}
	public static final boolean isEmpty(Cell c){
		return StringUtils.isEmpty(toStringValue(c));
	}
	public static final boolean isEmpty(String str){
		return StringUtils.isEmpty(str);
	}
}
